import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import uviewPlus from 'uview-plus'
// 导入Vuex store
import store from './store'
// 导入封装的axios实例
import request from './utils/request'
// 导入API接口
import * as api from './utils/api'
  import Popper from "vue3-popper";
// 导入路由守卫
import setupRouteGuard from './utils/routeGuard'

export function createApp() {
  const app = createSSRApp(App)


app.component("Popper", Popper);
  // 挂载Vuex store
  app.use(store)
   app.use(uviewPlus, () => {
		return {
			options: {
				// 修改config对象的属性
				config: {
					// 默认字体图标自托管资源地址
					iconUrl: 'https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf',
				}
			}
		}
	})

  // 将axios实例挂载到全局
  app.config.globalProperties.$request = request
  // 将API接口挂载到全局
  app.config.globalProperties.$api = api
  
  // 设置路由守卫
  //setupRouteGuard(app)

  return {
    app
  }
}
// #endif